/*
package com.mszlu.blog.controller;


import com.mszlu.blog.utils.QiniuUtils;
import com.mszlu.blog.vo.Result;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.mail.Multipart;
import javax.swing.plaf.multi.MultiToolTipUI;
import java.util.UUID;

@RestController
@RequestMapping("upload")
public class UploadController {

    @Autowired
    private QiniuUtils qiniuUtils;

    @PostMapping
    public Result upload(@RequestParam("image") MultipartFile file){
        //源文件名称
        String originalFilename = file.getOriginalFilename();
        //唯一的文件名称
        String fileName=UUID.randomUUID().toString()+"."+ StringUtils.substringAfterLast(originalFilename,".");
        //上传地址
        boolean upload=qiniuUtils.upload(file,fileName);
        if (upload){
            return Result.success(qiniuUtils.url+fileName);
        }
        return Result.fail(2000,"上传失败");

    }
}
*/
